package com.astrob.activitys;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.astrob.model.Msg;
import com.astrob.nhcmap.R;

public class EditImeActivity extends Activity {

	private EditText mEditText;
	private static String mStrEdit;
	
	public static String getEditResult() {
		return mStrEdit;
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_edit_ime);
		mEditText = (EditText)findViewById(R.id.edit_input);
		TextView title = (TextView)findViewById(R.id.title);
		
		
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			mStrEdit = extras.getString("editstring");	
			String strTitle = extras.getString("title");
			mEditText.setText(mStrEdit);
			if (strTitle != null && strTitle.length() > 0) {
				title.setText(strTitle);
			} else {
				title.setVisibility(View.INVISIBLE);
			}
		} else {
			mStrEdit = "";
			title.setVisibility(View.INVISIBLE);
		}
		
	}
	
	public void onBack(View v){
		finish();
	}
	
	public void onOK(View v) {
		mStrEdit = mEditText.getText().toString();
		setResult(Msg.EDITED_CONTENT);
		finish();
	}
	
	@Override
	protected void onResume() {
		super.onResume();
	}
	
	@Override
	protected void onPause() {
		super.onPause();
	}
}
